package com.hexorld.core;

import com.hexorld.utils.Position;

public abstract class HObject {
	public int width, height;
	public Position position = new Position(0,0);
	
	public HObject(){
	}
	public HObject(int width, int height, Position p){
		this.width = width;
		this.height = height;
		position.x = p.x;
		position.y = p.y;
	}
	
	public int getLeft(){
		return position.x;
	}
	public int getRight(){
		return getLeft()+this.width;
	}
	public int getTop(){
		return position.y;
	}
	public int getBottom(){
		return getTop()+this.height;
	}
	
	public void setPosition(int x, int y){
		position.x = x;
		position.y = y;
	}
	
	public void setSize(int width, int height){
		if(width >= 0)
			this.width = width;
		if(height >= 0)
			this.height = height;
	}
	
	public abstract void update(long timeElapsed);
}
